#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time   : 2023-11-25 20:12
# @Author : hard work
# @File    : renix_create_ethII_traffic.py
# @Description :
from renix_py_api.api_gen import BuildInterfaceCommand, StartIpv4PingCommand

from traffic_tool.tool_renix.renix_api.renix_create_ethII_traffic import Create_ethII_traffic


class Create_Ipv4Layer_traffic(Create_ethII_traffic):
    def __init__(self):
        super().__init__()
        self.hVlan = None
        self.hEthernet = None
        self.hStreamBlock = None
        self.srcMac_pkt_cnt = None
        self.dstMac_pkt_cnt = None
        self.FixedLoad = None
        self.Duration = None
        self.BurstSize = None
        self.BURSTS = None
        self.frameSize = None
        self.dstMac = None
        self.srcMac = None
        self.vid = None
        self.type = None
        self.prio = None
        self.hGeneratorConfig = None
        self.CrcError = None
        self.DurationMode = None

    def build_Ipv4Layer(self):
        build_ipv4 = BuildInterfaceCommand(InterfaceList=self.interface1, NetworkLayers=['eth', 'ipv4'])

        build_ipv4.execute()
        ipv4_layer = self.interface1.get_children('Ipv4Layer')[0]
        ipv4_layer.edit(Address='10.0.0.2', Step='0.0.0.1', Count='5', Gateway='10.0.0.1')

    def build_Ipv4PingConfig(self):
        start_ipv4_ping_cmd = StartIpv4PingCommand(InterfaceHandle=self.interface1.handle, FrameCount=3,
                                                   CustomIP='192.168.0.2')

        start_ipv4_ping_cmd.execute()











